package Eyjafjalla.card.skill;

import Eyjafjalla.action.GoodFriendAction;
import Eyjafjalla.action.MelodyAction;
import Eyjafjalla.action.TheEndAction;
import Eyjafjalla.card.AbstractEyjafjallaCard;
import Eyjafjalla.card.status.Cloud_Eyjafjalla;
import Eyjafjalla.patch.MelodyPatch;
import Eyjafjalla.subscriber.MelodySubscriber;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.*;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.DexterityPower;
import com.megacrit.cardcrawl.powers.LoseDexterityPower;
import com.megacrit.cardcrawl.powers.LoseStrengthPower;
import com.megacrit.cardcrawl.powers.StrengthPower;
import com.megacrit.cardcrawl.powers.watcher.VigorPower;

import java.util.ArrayList;

public class TheEnd_Eyjafjalla extends AbstractEyjafjallaCard implements MelodySubscriber {
    public static final String ID = "TheEnd_Eyjafjalla";
    private static final CardStrings cardStrings;

    public TheEnd_Eyjafjalla(){
        super(ID, cardStrings.NAME,0,cardStrings.DESCRIPTION,CardType.SKILL,CardRarity.UNCOMMON,CardTarget.NONE);
        setFireDescription(cardStrings.EXTENDED_DESCRIPTION[0]);
        this.baseMagicNumber = 1;
        this.magicNumber = 1;
        this.cardsToPreview = new Cloud_Eyjafjalla();
    }

    @Override
    public AbstractCard makeCopy() {
        return new TheEnd_Eyjafjalla();
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        if(isFire()){
            addToBot(new MakeTempCardInHandAction(cardsToPreview,1));
        }
        addToBot(new TheEndAction(this));
    }

    public String getNoteName(){
        return this.name;
    }

    public String getNoteString(){
        return cardStrings.EXTENDED_DESCRIPTION[1]+this.magicNumber+cardStrings.EXTENDED_DESCRIPTION[2];
    }

    @Override
    public MelodyPatch.MelodySingle getSingle() {
        return null;
    }

    @Override
    public ArrayList<AbstractGameAction> getNoteActions(boolean isFinal, int specialAmount) {
        ArrayList<AbstractGameAction> actions = new ArrayList<>();
        actions.add(new ApplyPowerAction(AbstractDungeon.player,AbstractDungeon.player,new VigorPower(AbstractDungeon.player,specialAmount),specialAmount));
        return actions;
    }

    @Override
    public int initializeSpecialAmount(boolean isFinal) {
        return this.magicNumber;
    }

    @Override
    public void upgrade() {
        if(!this.upgraded){
            upgradeName();
            upgradeMagicNumber(1);
        }
    }

    static {
        cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    }
}



